class Test:
  def __str__(self):
    return str(self.__dict__)

  def __init__(self):
    self.current_price = 8000
    self.direction = -1
    self.bond = 10000
    self.defence_percent = 0.30
    self.defence_hand = 4

    self.defence_price = None
    self.get_defence_price()

    self.inteval = None
    # self.defence_lost = 10000
    self.get_defence_lost()


  def get_defence_price(self):
    self.defence_price = self.current_price*(1 -self.direction* self.defence_percent)

  def get_defence_arr(self):
    arr_diff = [self.current_price,self.defence_price]
    self.inteval = inteval = (self.defence_price-self.current_price)/self.defence_hand
    self.inteval_percent = self.inteval/self.current_price

    arr0 = []
    for i in range(0,self.defence_hand+1):
      arr0.append(arr_diff[0] + i*inteval)
    self.defence_arr = arr0

  def get_defence_lost(self):
    self.get_defence_arr()

    losts = 0
    for n in range(0, self.defence_hand+1):
      losts += self.inteval * n

    self.defence_losts = losts


test = Test()

print(test)
